/*
 * Powered By XY
 * Since 2020
 */

package com.xy.biz.xd.manager.impl;

import com.xy.biz.xd.dao.DocumentReleaseCheckDao;
import com.xy.biz.xd.domain.bo.DocumentReleaseCheckBO;
import com.xy.biz.xd.domain.converter.DocumentReleaseCheckConverter;
import com.xy.biz.xd.domain.po.DocumentReleaseCheckPO;
import com.xy.biz.xd.domain.query.DocumentReleaseCheckQuery;
import com.xy.biz.xd.domain.query.DocumentReleaseQuery;
import com.xy.biz.xd.manager.DocumentReleaseCheckManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 *
 *
 * @author wcs
 * @date 2021-3-4
 */
@Service
public class DocumentReleaseManagerCheckImpl implements DocumentReleaseCheckManager {

    @Autowired
    private DocumentReleaseCheckDao documentReleaseCheckDao;

    /**
     * 保存
     *
     * @param documentReleaseCheckBO
     */
    @Override
    public int saveDocumentReleaseCheck(DocumentReleaseCheckBO documentReleaseCheckBO) {
        return documentReleaseCheckDao.saveDocumentReleaseCheck(DocumentReleaseCheckConverter.toPO(documentReleaseCheckBO));
    }

    /**
     * 保存多个
     *
     * @param collection
     */
    @Override
    public int saveAllDocumentReleaseCheck(Collection<DocumentReleaseCheckBO> collection) {
        return documentReleaseCheckDao.saveAllDocumentReleaseCheck(DocumentReleaseCheckConverter.toPO(collection));
    }

    /**
     * 查找一个
     *
     * @param documentReleaseCheckId
     * @return
     */
    @Override
    public DocumentReleaseCheckBO getDocumentReleaseCheck(Long documentReleaseCheckId) {
        return DocumentReleaseCheckConverter.fromPO(documentReleaseCheckDao.getDocumentReleaseCheck(documentReleaseCheckId));

    }

    /**
     * 查找多条
     *
     * @param collection
     * @return
     */
    @Override
    public List<DocumentReleaseCheckBO> listDocumentReleaseCheckById(Collection<Long> collection) {
        return DocumentReleaseCheckConverter.fromPO(documentReleaseCheckDao.listDocumentReleaseCheckById(collection));
    }

    /**
     * 查找多条
     *
     * @param collection
     * @return
     */
    @Override
    public List<DocumentReleaseCheckBO> listDocumentReleaseCheckByReleaseId(Collection<Long> collection) {
        return DocumentReleaseCheckConverter.fromPO(documentReleaseCheckDao.listDocumentReleaseCheckByReleaseId(collection));
    }

    @Override
    public List<DocumentReleaseCheckBO> listDocumentReleaseCheckByRepositoryIdAndSourceFolderId(DocumentReleaseCheckQuery query) {
        return DocumentReleaseCheckConverter.fromPO(documentReleaseCheckDao.listDocumentReleaseCheckByRepositoryIdAndSourceFolderId(query));
    }

    /**
     * 查询当前用户的签收列表
     * @param repositoryId
     * @param collect  releaseId
     * @return
     */
    @Override
    public List<DocumentReleaseCheckBO> listDocumentReleaseCheckByRepositoryIdAndDocumentReleaseId(Long repositoryId, Set<Long> collect) {
        return DocumentReleaseCheckConverter.fromPO(documentReleaseCheckDao.listDocumentReleaseCheckByRepositoryIdAndDocumentReleaseId(repositoryId, collect));
    }

    /**
     * 查找一个
     *
     * @param documentReleaseCheckBO
     * @return
     */
    @Override
    public DocumentReleaseCheckBO getDocumentReleaseCheck(DocumentReleaseCheckBO documentReleaseCheckBO) {
        DocumentReleaseCheckPO documentReleaseCheckPO = DocumentReleaseCheckConverter.toPO(documentReleaseCheckBO);
        return DocumentReleaseCheckConverter.fromPO(documentReleaseCheckDao.getDocumentReleaseCheckByRelease(documentReleaseCheckPO));
    }

    @Override
    public int deleteDocumentReleaseCheckByDocumentReleaseId(Collection<Long> documentReleaseIds) {
        return documentReleaseCheckDao.deleteDocumentReleaseCheckByDocumentReleaseId(documentReleaseIds);
    }
}
